﻿using OMG.Fill.Vegetable.Model.Ent;
using OMG.Fill.Vegetable.Service;
using ProjectShare;
using System.Collections.Generic;
using System.Web.Http;
namespace OMG.Fill.Vegetable.Model.UI.Controllers
{
    public class MenuController : ApiController
    {
        MenuServices menuServices = new MenuServices();
        
        //[ApiActionAuthorize("获取功能菜单表T_Menu分页列表对象操作")]
        //[ApiActionException]
        public Pager<List<MenuModel>> PostPageList(MenuQuery query)
        {
            return menuServices.GetPageList(query);
        }
        //[ApiActionAuthorize("新增功能菜单表T_Menu指定对象操作")]
        //[ApiActionException]
        public ResResult<int> Post(MenuEntity model) {
            return menuServices.AddInfo(model);
        }
        //[ApiActionAuthorize("修改功能菜单表T_Menu指定对象操作")]
        //[ApiActionException]
        public ResResult<int> Put(MenuEntity model)
        {
            return menuServices.UpdateInfo(model);
        }
        //[ApiActionAuthorize("删除功能菜单表T_Menu指定对象操作")]
        //[ApiActionException]
        public ResResult<int> Delete(string id)
        {
            return menuServices.DeleteInfo(id);
        }
        //[ApiActionAuthorize("获取功能菜单表T_Menu指定对象操作")]
        //[ApiActionException]
        public ResResult<MenuEntity> Get(string id)
        {
            return menuServices.GetModel(id);
        }

        public ResResult<List<MenuTree>> Get(string Account, string UserId)
        {
            return menuServices.getUserMenu(Account, UserId);
        }
        public ResResult<List<SortMenuModel>> GetParents()
        {
            return menuServices.GetParents();
        }
    }
}